home *** CD-ROM | disk | FTP | other *** search
- This is Modula-2 code that could be used to display a Sliced Ham picture. At
- this stage, I'll assume you've read and displayed the file like a normal HAM
- picture. I'll also assume that you've moved the file pointer to point to the
- SHAM chunk's first byte of data (which follows the SHAM identifier, chunk
- size, and a version word (currently 0). Take a look at a SHAM picture before
- you start. Each word is in the form 0rgb.
-
- I've stretched the code out a bit to try to make it obvious to people
- unfamiliar with Modula-2. Clever coders can make this code much smaller and
- more efficient.
-
- I hope we see assembly and C code posted soon.
-
-
- (* Let's move the palette into an array for clarity *)
-
- FOR i := 0 TO 199 DO
- FOR j := 0 TO 15 DO
- dummy := Read(f,ADR(k),2);
- rPalette[i,j] := INTEGER(k) DIV 256;
- gPalette[i,j] := INTEGER(k) DIV 16 MOD 16;
- bPalette[i,j] := INTEGER(k) MOD 16;
- END;
- END;
-
- (* first handle top line *)
-
- SetRGB4(vp,0,0,0,0);
- FOR i := 1 TO 15 DO
- SetRGB4(vp,i,rPalette[0,i],gPalette[0,i],bPalette[0,i]);
- END;
-
- (* now the rest *)
-
- ucop := AllocMem(TSIZE(UCopList),MemReqSet{MemChip,MemClear});
- FOR i := 1 TO 199 DO
- CWAIT(ucop,i,0);
- FOR j := 1 TO 15 DO
- CMOVE(ucop,ADR(custom^.color[j]),rPalette[i,j]*256+
- gPalette[i,j]*16+bPalette[i,j]);
- END;
- END;
- CEND(ucop);
-
- (* Now tell the Amiga *)
-
- WITH vp^ DO
- dspins := DspIns;
- sprins := SprIns;
- clrins := ClrIns;
- END;
- vp^.UCopIns := ucop;
- RethinkDisplay();
-
- (* Time Waster *)
-
- WHILE GetMsg(window^.UserPort)=NIL DO END;
-
- (* Clean up *)
-
- FreeVPortCopLists(vp);
- RemakeDisplay();
- CloseWindow(window);
- CloseScreen(scr);
-
- BEGIN
- BuildScreen();
- END vSup.
-